package com.lam.fundamental;

import java.util.ArrayList;
import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import com.lam.communication.DailActivity;
import com.lam.communication.MailActivity;
import com.lam.communication.SMSActivity;
import com.lam.services.msgnotice.MessageNoticeActivity;
  
public class CommucicationFragment extends Fragment  implements OnClickListener{  
  
    @Override  
    public View onCreateView(LayoutInflater inflater, ViewGroup container,  
            Bundle savedInstanceState) {  
    	View view=inflater.inflate(R.layout.fragment_communication, container, false);  
    	setButtonListener(view);
    	
        return view;
    }  
    
	private void setButtonListener(View view) {
	// TODO Auto-generated method stub
	ArrayList<Button> buttons=new ArrayList<Button>();
	buttons.add((Button)view.findViewById(R.id.bt_dail));
	buttons.add((Button)view.findViewById(R.id.bt_sendMsg));
	buttons.add((Button)view.findViewById(R.id.bt_service_msg));
	buttons.add((Button)view.findViewById(R.id.bt_mail));
	
	
	for (int i = 0; i < buttons.size(); i++) {
		if(buttons.get(i)!=null){
			buttons.get(i).setOnClickListener(this);
		}
	}
}

@Override
public void onClick(View v) {
	// TODO Auto-generated method stub
	Intent intent =new Intent();
//	Log.i("onclick", "click");
	
	switch (v.getId()) {
	
	case R.id.bt_dail:
		intent.setClass(getActivity(), DailActivity.class);
		startActivity(intent);
		break;

	case R.id.bt_sendMsg:
			intent.setClass(getActivity(), SMSActivity.class);
			startActivity(intent);
			break;
	
	case R.id.bt_service_msg:
		intent.setClass(getActivity(), MessageNoticeActivity.class);
		startActivity(intent);
		break;
	
	case R.id.bt_mail:
		intent.setClass(getActivity(), MailActivity.class);
		startActivity(intent);
		break;
	default:
		
		break;
	}
}


  
}  